package net.tngou.iask.action;

import java.io.IOException;
import javax.servlet.ServletException;
import net.tngou.iask.enums.LevelEnum;


/**
 * 
 * @author tngou@tngou.net
 *
 */
public class LoginAction extends BaseAction {

	@Override
	public void execute() throws ServletException, IOException {
		root.put("title", "系统登录-"+ststeminfo().get("name"));
		printFreemarker("default/login.ftl", root);
	}
	
	
	/**
	 * 退出
	 */
	public void exit()
	{
		String session_id= request.getParams()!=null?request.getParams()[0]:null;
		
		if (tngou_id.equals(session_id)&&user!=null)
		{		
			saveLog(LevelEnum.common, user.getAccount()+" 账户安全退出!");
			session.deleteUser(tngou_id);
//			String filter="user='"+user.getId()+"'";
//			new Login().delete(filter);		
			response.removeAutoLoginCookie();//溢出cook
			
		}
		sendRedirect(getDomain());

	}
}
